home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13978 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.missouri.edu!MU
  2. From: c576537@mizzou1.missouri.edu (Chris Vogel)
  3. Newsgroups: comp.lang.c++
  4. Subject: dynamic arrays using char with far pointers
  5. Date: 27 Mar 1996 22:40:21 GMT
  6. Organization: University of Missouri
  7. Message-ID: <4jcg4l$18hq@news.missouri.edu>
  8. NNTP-Posting-Host: mizzou-ts5-05.missouri.edu
  9. X-Newsreader: News Xpress Version 1.0 Beta #4
  10.  
  11. I'm converting some code I have out of a book to C++.  I'm converting a 
  12. structure to a class(kind of logical :) ).  The structure has:
  13.  
  14.     char far *buffer;
  15.  
  16. Now, I thought that to initialize it, it would be:
  17.  
  18.     buffer = new char[size];
  19.  
  20. but that gives me a run time error.  So, I changed it to:
  21.  
  22.     buffer = new (char far *)[size];
  23.  
  24. but then, when I read in data and put it in the data I get an even worse run 
  25. time error, because it restarts the computer.  I make sure my index is not 
  26. greater than size, but it still kicks me out.  Could someone suggest an 
  27. answer.  I guess I could always use malloc, but new basically is better.  If 
  28. it matters, I'm using Borland C++ 4.5 for DOS.
  29.     
  30. Thanks in advance,
  31.  
  32. Chris Vogel
  33.